/**
 * There are code generation
 */
package com.neusoft.lohas.modules.ivm.entity.merchant;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Where;

import com.neusoft.lohas.common.persistence.IdEntity;

/**
 * 商户Entity
 * @author Jackie.Liu
 * @version 2014-10-22
 */
@Entity
@Table(name = "ivm_merchant")
@DynamicInsert @DynamicUpdate
public class Merchant extends IdEntity<Merchant> {
	
	private static final long serialVersionUID = 1L;
	private String name; 		// 名称
	private String assisTitle; 	//副标题
	private String shopUrl; 	//商店链接
	private String logoUrl; 	//商户logo地址
	private String openState; 	//是否开放：1是，0否
	private ActivityPoster activityPoster; //小店公告
	private MerchantClause merchantClause; //配送规则
	private String payCode;		//商户结款密码
	
	public Merchant() {
		super();
	}

	public Merchant(String id){
		this();
		this.id = id;
	}
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAssisTitle() {
		return assisTitle;
	}

	public void setAssisTitle(String assisTitle) {
		this.assisTitle = assisTitle;
	}

	public String getShopUrl() {
		return shopUrl;
	}

	public void setShopUrl(String shopUrl) {
		this.shopUrl = shopUrl;
	}

	public String getLogoUrl() {
		return logoUrl;
	}

	public void setLogoUrl(String logoUrl) {
		this.logoUrl = logoUrl;
	}

	public String getOpenState() {
		return openState;
	}
	
	public void setOpenState(String openState) {
		this.openState = openState;
	}

	@OneToOne(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "merchant")
	@Where(clause="del_flag='"+DEL_FLAG_NORMAL+"'")
	@NotFound(action = NotFoundAction.IGNORE)
	public ActivityPoster getActivityPoster() {
		return activityPoster;
	}

	public void setActivityPoster(ActivityPoster activityPoster) {
		this.activityPoster = activityPoster;
	}

	@OneToOne(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "merchant")
	@Where(clause="del_flag='"+DEL_FLAG_NORMAL+"'")
	@NotFound(action = NotFoundAction.IGNORE)
	public MerchantClause getMerchantClause() {
		return merchantClause;
	}

	public void setMerchantClause(MerchantClause merchantClause) {
		this.merchantClause = merchantClause;
	}

	public String getPayCode() {
		return payCode;
	}

	public void setPayCode(String payCode) {
		this.payCode = payCode;
	}
	
}


